﻿using DomainModel;
using FluentNHibernate.Mapping;

namespace Repository.NHibernate.Mapping
{
    public class UserMap : ClassMap<User>
    {
        public UserMap()
        {
            Id(x => x.Id).GeneratedBy.Native();
            
            Map(x => x.Login);
            Map(x => x.PasswordHash);
            Map(x => x.Email);
            Map(x => x.Approved);
            Map(x => x.Role);
            
            References<Group>(x => x.Group);
            References<User>(x => x.Child);

            HasOne(x => x.UserProfile).Cascade.All()/*.ForeignKey("UserProfile")*/;
        }
    }
}